package fit.glike.net.domain;

import lombok.Data;

@Data
public class NetConfigDomain {

    /**
     * 配置信息名称
     */
    private String name;
    /**
     * 配置名称
     */
    private String cfgName;
    /**
     * 代理类型
     */
    private String[] proto;
    /**
     * 配置信息外网端口
     */
    private String srcPort;
    /**
     * 配置信息内网IP
     */
    private String destIp;
    /**
     * 配置信息内网端口
     */
    private String destPort;

    private String sysauth;
    private String token;

    public NetConfigDomain() {
    }

    public NetConfigDomain(String sysauth, String token, String name, String cfgName, String[] proto, String srcPort, String destIp, String destPort) {
        this.sysauth = sysauth;
        this.token = token;
        this.name = name;
        this.cfgName = cfgName;
        this.proto = proto;
        this.srcPort = srcPort;
        this.destIp = destIp;
        this.destPort = destPort;
    }

    public void setNetConfigByMacInfo(MacConfigDomain macInfo) {
        this.name = macInfo.getName();
        this.srcPort = macInfo.getWanPort();
        this.destIp = macInfo.getLanIp();
        this.destPort = macInfo.getLanPort();
    }

    public String toCustomString() {
        return String.format("设备名称:%s, 外网端口:%s, 内网IP:%s, 内网端口:%s; \n", name, srcPort, destIp, destPort);
    }
}
